from flask import Flask
from app import create_app as create_front_app
from admin import create_app_admin as create_admin_app
import os

# 创建主Flask应用
main_app = Flask(__name__)
main_app.config.from_object('config')

# 配置主应用
main_app.config['SECRET_KEY'] = 'xpx-20070105-hhzz'
# 其他全局配置...

# 创建并注册前台蓝图
front_app = create_front_app()
main_app.register_blueprint(front_app)

# 创建并注册后台蓝图
admin_app = create_admin_app()
main_app.register_blueprint(admin_app, url_prefix='/admin')  # 给后台添加URL前缀

# 检查静态文件夹路径
print("静态文件夹路径:", main_app.static_folder)
file_path = os.path.join(main_app.static_folder, 'users', '20250722083742_2_201019105F8-5-1200.jpg')
print("文件是否存在:", os.path.exists(file_path))

if __name__ == '__main__':
    main_app.run(debug=True)